package com.member.shop.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.member.common.annotation.Excel;
import com.member.common.config.RmConfig;
import com.member.common.constant.SystemConst;
import com.member.common.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.apache.commons.lang3.StringUtils;

/**
 * 抽奖奖品对象 sys_biz_raffle_prize
 *
 * @author lxc
 * @date 2024-03-14
 */
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@TableName("sys_biz_raffle_prize")
public class SysBizRafflePrize extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 奖品ID
     */
    @TableId(type = IdType.AUTO)
    private Long prizeId;

    /**
     * 奖品名称
     */
    @Excel(name = "奖品名称")
    private String prizeName;

    /**
     * 奖品类型（1：积分，2：优惠券，3.实物，4：谢谢惠顾）
     */
    @Excel(name = "奖品类型", readConverterExp = "1=：积分，2：优惠券，3.实物，4：谢谢惠顾")
    private Integer prizeType;

    /**
     * 奖品图片
     */
    @Excel(name = "奖品图片")
    private String prizeImage;
    @TableField(exist = false)
    private String prizeImageAbsolute;

    public String getPrizeImage() {
        return prizeImage;
    }

    public void setPrizeImage(String prizeImage) {
        this.prizeImage = prizeImage;


        prizeImageAbsolute = prizeImage;
        String domain = RmConfig.getDomain();
        if (StringUtils.isNotEmpty(prizeImage) && !prizeImage.startsWith(SystemConst.HTTP)) {
            prizeImageAbsolute = domain + prizeImage;
        }
    }

    public String getPrizeImageAbsolute() {
        return prizeImageAbsolute;
    }

    public void setPrizeImageAbsolute(String prizeImageAbsolute) {
        this.prizeImageAbsolute = prizeImageAbsolute;
    }


    /**
     * 奖品说明
     */
    @Excel(name = "奖品说明")
    private String prizeDetails;

    /**
     * 数量
     */
    @Excel(name = "数量")
    private Long prizeAmount;

    /**
     * 是否发布(0:已发布，1:未发布)
     */
    @Excel(name = "是否发布(0:已发布，1:未发布)")
    private Long displayed;

    /**
     * 排序
     */
    @Excel(name = "排序")
    private Long sort;

    /**
     * 奖品库存
     */
    @Excel(name = "奖品库存")
    private Long prizeStock;

    /**
     * 是否奖品(0:奖品，1:非奖品)
     */
    @Excel(name = "是否奖品(0:奖品，1:非奖品)")
    private Long isPrize;

    /**
     * 是否删除(0：未删除，1：删除)
     */
    @Excel(name = "是否删除(0：未删除，1：删除)")
    private Integer deleted;

    /**
     * 概率模式(概率值)
     */
    @TableField(exist = false)
    private String prizeProbability;

}
